#include<bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int s[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    int mi=100005,ma=-1;
    for(int i=0;i<n;i++){
        int t;
        cin>>t;
        a[t]++;
        mi=min(mi,t),ma=max(ma,t);
    }
    for(int i=1;i<=ma;i++){
        s[i]=s[i-1]+a[i-1];
    }
    int t=n;
    for(int i=mi+1;i<=ma;i++){
        t=t-min(a[i],s[i]-n+t);
    }
    cout<<t;
    return 0;
}
